# 使用官方.NET Core SDK作为基础镜像
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
RUN dotnet --info
# 设置工作目录
WORKDIR /app
# 将WebApplication2目录内容复制到容器的/app目录下
COPY ./WebApplication2/ /app
# 运行dotnet命令来恢复依赖项
RUN dotnet restore
# 编译项目
RUN dotnet build -c Release -o out
# 使用发布镜像
#FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS runtime
WORKDIR /app
COPY --from=build /app/out .
COPY --from=build /app/wwwroot ./wwwroot

#RUN dotnet publish -o /out -c Release
EXPOSE 8080
ENTRYPOINT ["dotnet", "WebApplication2.dll"]